In the field of communication and computer, it generally needs to store and forward data packets, and the storage device is generally a big read/write memory. In order to facilitate management and improve utilization, this big piece of memory is logically divided into a plurality of small blocks, which are called as memory blocks. Each memory block has an index. In principle, one memory block can only store one data packet at most, and one data packet may occupy a plurality of memory blocks. In the process of scheduling data packets, the index of the memory block occupied by the header of the data packet is usually used as the index of the data packet. When there is a data packet that need to be buffered, idle memory blocks are assigned for storage; after the data packet is scheduled out, the memory block occupied by the data packet needs to be released for subsequent use. This process is generally called as reclaiming of a memory block.
A reclaiming judging apparatus is used to judge when to reclaim the memory block. As for data packets of unicast type, reclaiming can be performed after the data packet is scheduled for one time; as for data packets of multicast type, reclaiming can only be performed after the data packet has been scheduled for a specified number of times. The reclaiming judging apparatus has to obtain the required scheduling times for the data packet from an upstream module on one hand, and calculate the times that the data packet has been scheduled on the other hand. Regarding the same data packet, these two kinds of information are not necessarily acquired in a fixed sequence. In the existing method, usually two sets of registers or memories are used, one set recording the required scheduling times for memory block/data packet, and the other recording the times that the data packet has been scheduled, and it is judged whether to reclaim the memory block occupied by the data packet by comparing the two kinds of information.
However, as for a large number of data packets, these two sets of registers will consume a large amount of resources. In terms of processing, some methods manage based on memory blocks, but there is certain difficulty in reclaiming as for a data packet occupying a plurality of memory blocks.